import matplotlib.pyplot as plt

class_names = ['高二1班', '高二2班', '高二3班', '高二4班', '高二5班', '高二6班']
avg_scores_male = [90.5, 89.5, 88.7, 88.5, 85.2, 86.6]
avg_scores_female = [92.7, 87, 90.5, 85, 89.5, 89.8]
plt.bar(class_names, avg_scores_male, label='男生')
plt.bar(class_names, avg_scores_female, label='女生')

plt.xlabel('班级名称')
plt.ylabel('平均成绩')
plt.title('高二各班男生、女生英语平均成绩')
plt.legend()

plt.show()